package com.dingding.dao.chatmessagedao.impl;

import org.apache.log4j.Logger;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.dingding.common.core.base.dao.impl.BaseDaoImpl;
import com.dingding.common.core.beans.ChatMessages;
import com.dingding.dao.chatmessagedao.IChatMessageDao;

/**
 * @ClassName: ChatMessageDaoImpl 
 * @Description: 聊天消息DAO实现类 
 * @author YHQ
 * @date 2016年4月22日 下午5:18:33
 */
public class ChatMessageDaoImpl extends BaseDaoImpl<ChatMessages> implements IChatMessageDao {

	private Logger log = Logger.getLogger(this.getClass());
	
	/**
	 * @Title: saveChatMessage 
	 * @Description: 保存聊天信息
	 * @param chatMessages 要保存的聊天信息
	 * @author YHQ 
	 * @return boolean    true:成功  false:失败
	 */
	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public boolean saveChatMessage(ChatMessages chatMessages) {
		
		try {
			super.save(chatMessages);
			
			return true;
		} catch (Exception e) {
			log.error("保存聊天记录时出现异常   类："+this.getClass()+" saveChatMessage()", e);
		}
		
		return false;
	}

}
